//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.tuliu.appupdate.crash;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.provider.Settings.System;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import java.lang.reflect.Method;

class DeviceUtils {
    private static final String DEFAULT_IMEI = "360_DEFAULT_IMEI";

    DeviceUtils() {
    }

    static String getIMEI2(Context context) {
        String imei = getIMEI(context);
        String androidId = System.getString(context.getContentResolver(), "android_id");
        String serialNo = getDeviceSerial();
        return Md5Utils.md5LowerCase("" + imei + androidId + serialNo);
    }

    private static String getDeviceSerial() {
        String serial = "";

        try {
            Class ignored = Class.forName("android.os.SystemProperties");
            Method get = ignored.getMethod("get", new Class[]{String.class});
            serial = (String)get.invoke(ignored, new Object[]{"ro.serialno"});
        } catch (Exception var3) {
            ;
        }

        return serial;
    }

    static String getIMEI(Context context) {
        try {
            String imei = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
            if(!TextUtils.isEmpty(imei)) {
                return imei;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return "360_DEFAULT_IMEI";
    }

    static String getVersionName(Context mContext) {
        try {
            PackageInfo e = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
            return e.versionName;
        } catch (Exception var2) {
            var2.printStackTrace();
            return "";
        }
    }

    static String getVersionCode(Context mContext) {
        try {
            PackageInfo e = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
            return String.valueOf(e.versionCode);
        } catch (Exception var2) {
            var2.printStackTrace();
            return "";
        }
    }
}
